<template>
   <el-table
      :data="tableData"
      style="width: 100%">
      <el-table-column
        prop="data"
        label="项目"
        width="180">
      </el-table-column>
      <el-table-column
        prop="name"
        label="金额"
        width="180">
      </el-table-column>
    </el-table>
</template>

<script>
  export default {
      props:["dataObj"],
      mounted() {
        this.ObjToArr()
      },
      created() {
        
      },
      watch:{
        dataObj:function(){
        this.ObjToArr()
        }
      },
      computed:{

      },
    data() {
      return {
        tableData: []
      }
    },
    methods:{
      ObjToArr:function(){
      let arr=[]
      let JsonObj=JSON.stringify(this.dataObj)
      
      let JsonBbjByRep=JsonObj.replace(/userName/,"姓名")
      JsonBbjByRep=JsonBbjByRep.replace(/wage/,"工资")
      JsonBbjByRep=JsonBbjByRep.replace(/otherMoney/,"其他")
      JsonBbjByRep=JsonBbjByRep.replace(/reward/,"奖励")
      JsonBbjByRep=JsonBbjByRep.replace(/should/,"应发数")
      JsonBbjByRep=JsonBbjByRep.replace(/old/,"养老")
      JsonBbjByRep=JsonBbjByRep.replace(/medical/,"医保")
      JsonBbjByRep=JsonBbjByRep.replace(/loseJob/,"失业")
      JsonBbjByRep=JsonBbjByRep.replace(/tradeUnion/,"工会")
      JsonBbjByRep=JsonBbjByRep.replace(/housingFund/,"公积金")
      JsonBbjByRep=JsonBbjByRep.replace(/takeOff/,"工扣数")
      JsonBbjByRep=JsonBbjByRep.replace(/total/,"实发数")
      JsonBbjByRep=JsonBbjByRep.replace(/sheetName/,"月份")
      
      let Obj=JSON.parse(JsonBbjByRep)
      
        for (let i in Obj) {
          let tempObj = {};
          tempObj["data"]=i;
          tempObj["name"]=Obj[i]
          arr.push(tempObj)  
        }
        this.tableData=arr
    }
    }
    
    
  }
</script>

<style scoped>
    table{
        border-collapse: collapse;
        text-align: center;
        width: 100%;
        border-color: #dfdfe1
    }
</style>


